package com.syy.outputformat;


import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import java.io.IOException;

public class LogDriver {
    public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException {
        Configuration configuration = new Configuration();

        Job job = Job.getInstance(configuration);

        job.setJarByClass(LogDriver.class);


        // 设置自定义输出类
        job.setOutputFormatClass(LogOutputFormat.class);

        FileInputFormat.setInputPaths(job, new Path("F:\\projects\\JavaProjects\\myproject\\JavaProjects\\MapReduceDemo\\src\\main\\resources\\input2\\log.txt"));
        FileOutputFormat.setOutputPath(job, new Path("F:\\projects\\JavaProjects\\myproject\\JavaProjects\\MapReduceDemo\\src\\main\\resources\\output3"));

        boolean b = job.waitForCompletion(true);
        System.out.println(b ? "成功" : "失败");
    }
}
